import gtk, pygtk, math
pygtk.require('2.0')
import Point

class Board(gtk.DrawingArea):
	
	def __init__(self):
		gtk.DrawingArea.__init__(self)
		self.set_size_request(400,300)
		self.set_events(gtk.gdk.BUTTON_PRESS_MASK)
		self.connect("button_press_event", self.button_press_event)
		
		drawing_state = gtk.STATE_NORMAL # no special state of operation
		bg_color = gtk.gdk.Color('white')
		self.modify_bg(drawing_state, bg_color)
		
		self.points = []
		
		
	def button_press_event(self, widget, event):
		""" Tells someone clicked inside the drawing area"""
		print("clicked") # debug only
		self.points.append(Point.Point(event.x,event.y))	# remember the points to draw the picture after
#		for p in self.points: 
#			print(p.get())
		# top acochambrado! Desanhando uma circunferencia minuscula
		cr = self.window.cairo_create()
		cr.arc(event.x, event.y, 0.01, 0, 2*math.pi)
		cr.stroke_preserve()
		cr.set_source_rgb(0, 0, 0)
		cr.fill()

		return True
		

